package cn.edu.zjgsu.ito.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.core.ActionInvocation;
import com.jfinal.core.Controller;

public class TeacherControllerInterceptor implements Interceptor {

	/*
	 * 张虎涛
	 * 2016/06/01
	 */
	@Override
	public void intercept(ActionInvocation ai) {
		try{
			Controller controller = ai.getController();
			String tNo=controller.getSessionAttr("tNo");
			
			if(tNo==null||tNo.equals("")){
				ai.getController().redirect("/toErrors");
				return;
			}else{
				System.out.println("正常使用");
				ai.invoke();
				return;
			}
		}catch(Exception e){
			e.printStackTrace();
		}

	}

}
